<template>
  <div>
    <button @click="Fn">生成</button>
    <ul>
      <li v-for="(item, index) in arr">
        {{ item }}
        <button @click="del(index)">删除</button>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      arr: ["1", "2"],
    };
  },
  methods: {
    Fn() {
      let a = this.arr.push(Math.floor(Math.random() * 10));
      console.log(a);
    },
    del(index) {
      this.arr.splice(index, 1);
    },
  },
};
</script>

<style>
</style>